﻿using System;
using System.ComponentModel;
using Microsoft.WowAddonStudio.FrameXml.Serialization;

namespace Microsoft.WowAddonStudio.FrameXml.Components
{
    public interface IFrameXmlComponent : IComponent
    {
        /// <summary>
        /// Gets or sets the serialization object.
        /// </summary>
        SerializationObject SerializationObject { get; set; }

        /// <summary>
        /// Gets or sets the name of the component.
        /// </summary>
        string Name { get; set; }

        /// <summary>
        /// Gets or sets the parent FrameXML component.
        /// </summary>
        IFrameXmlComponent Parent { get; set; }

        /// <summary>
        /// Gets the type of the serialization object.
        /// </summary>
        Type SerializationObjectType { get; }

        /// <summary>
        /// Expands a name by replacing the parent token with the name of the layout frame.
        /// </summary>
        /// <param name="name">The name to expand.</param>
        /// <returns>The expanded name.</returns>
        string ExpandName(string name);

        /// <summary>
        /// Expands the name of a named object.
        /// </summary>
        /// <param name="namedObject">The named object.</param>
        /// <returns>The expanded name.</returns>
        string ExpandName(INamedObject namedObject);

        /// <summary>
        /// Initializes the name.
        /// </summary>
        void InitializeName();
    }
}
